import React, { Component } from 'react'
import { View, Text, StyleSheet } from 'react-native'
import Dialog, { SlideAnimation, DialogTitle, DialogFooter, DialogButton, DialogContent } from 'react-native-popup-dialog'
import commonStyle from '../../libs/commonStyle'

export default class DialogCom extends Component {
	render () {
	    const {containerStyle, visible, onClose, content } = this.props
		return (
			<View style={[styles.container, {containerStyle}]}>
			  <Dialog
					width={0.6}
					visible={visible}
					onTouchOutside={() => {
						if(typeof onClose === 'function') {
						onClose()
						}
					}}
			  >
			    <DialogContent style={[commonStyle.p10, commonStyle.pt40, commonStyle.flexCenter]}>
						{this.props.children}
						<Text style={[commonStyle.activeColor]}>{content}</Text>
			    </DialogContent>
			  </Dialog>
			</View>
		)
	}
}

const styles = StyleSheet.create({
	container: {
		width: '80%'
	}
})